package tod141.medlemsliste.skjemadata;

import tod141.medlemsliste.model.Klient;

public class NyKlient {
	private String browserType;
	private String browserVersion;
	private String os;
	private String screenSize;
	private String browserSize;
	private String color;
	private String position;
	
	public void setBrowserType(String browserType) {
		this.browserType = browserType;
	}
	public void setBrowserVersion(String browserVersion) {
		this.browserVersion = browserVersion;
	}
	public void setOs(String os) {
		this.os = os;
	}
	public void setScreenSize(String screenSize) {
		this.screenSize = screenSize;
	}
	public void setBrowserSize(String browserSize) {
		this.browserSize = browserSize;
	}
	public void setColor(String color) {
		this.color = color;
	}
	public void setPosition(String position) {
		this.position = position;
	}
	
	public Klient getKlient(){
		int color;
		try {
			color = Integer.parseInt(this.color);
		} catch(NumberFormatException e) {
			return null;
		}
		if (color < 0) { return null; }
		
		Klient klient = new Klient();
		klient.setBrowserType(this.browserType);
		klient.setBrowserVersion(this.browserVersion);
		klient.setOs(this.os);
		klient.setScreenSize(this.screenSize);
		klient.setBrowserSize(this.browserSize);
		klient.setColor(color);
		klient.setPosition(this.position);
		return klient;
	}
}
